package com.heima.article.controller.v1;

import com.heima.article.service.ApArticleService;
import com.heima.common.constant.ArticleConstant;
import com.heima.model.article.dots.*;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.pojos.WmNews;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/v1")
public class ArticleHomeController {
    @Autowired
    ApArticleService apArticleService;
    @PostMapping("/article/load")
    public ResponseResult load(@RequestBody ArticleHomeDto dto)
    {
        return apArticleService.loadHot(dto);
//        return apArticleService.load(dto);
    }
    @PostMapping("/article/loadmore")
    public ResponseResult loadMore(@RequestBody ArticleHomeDto dto)
    {
        dto.setType(ArticleConstant.LOADTYPE_LOAD_MORE);
        return apArticleService.load(dto);
    }
    @PostMapping("/article/loadnew")
    public ResponseResult loadNew(@RequestBody ArticleHomeDto dto)
    {
        dto.setType(ArticleConstant.LOADTYPE_LOAD_NEW);
        return apArticleService.load(dto);
    }
    @PostMapping("/collection_behavior")
    public ResponseResult collectionBehavior(@RequestBody CollectionBehaviorDto dto)
    {
        return apArticleService.collectionBehavior(dto);
    }
    @PostMapping("/article/load_article_behavior")
    public ResponseResult loadArticleBehavior(@RequestBody ArticleInfoDto dto)
    {
        return apArticleService.loadArticleBehavior(dto);
    }
    





}
